
#include <BOpenGL>

#include "member_BUniform.h"

using namespace BWE;

member_BUniform::member_BUniform(BUniform* uniform)
{
	boss = uniform;
	location = -1;
	dirty = true;
}
member_BUniform::~member_BUniform()
{

}

void member_BUniform::init(BUniform::Type type, int size)
{
	this->type = type;
	this->size = size;
	if (size < 0)
		return;
	switch (type)
	{
	case BUniform::Type_Int:
		value.resize(sizeof(int) * size);
		break;
	case BUniform::Type_UInt:
		value.resize(sizeof(unsigned int) * size);
		break;
	case BUniform::Type_Float:
		value.resize(sizeof(float) * size);
		break;
	case BUniform::Type_Double:
		value.resize(sizeof(double) * size);
		break;
	case BUniform::Type_Vec2f:
		value.resize(sizeof(BPointf) * size);
		break;
	case BUniform::Type_Vec2d:
		value.resize(sizeof(BPointd) * size);
		break;
	case BUniform::Type_Vec3f:
		value.resize(sizeof(BVectorf) * size);
		break;
	case BUniform::Type_Vec3d:
		value.resize(sizeof(BVectord) * size);
		break;
	case BUniform::Type_Vec4f:
		value.resize(sizeof(BColorf) * size);
		break;
	case BUniform::Type_Vec4d:
		value.resize(sizeof(double) * 4 * size);
		break;
	case BUniform::Type_Matrixf:
		value.resize(sizeof(BMatrixf) * size);
		break;
	case BUniform::Type_Matrixd:
		value.resize(sizeof(BMatrixd) * size);
		break;
	default:
		break;
	}
	dirty = true;
}
